package cn.tedu.yxc;

import com.sun.corba.se.impl.orb.ParserTable;
import org.apache.commons.lang3.RandomStringUtils;
import org.apache.commons.lang3.RandomUtils;

public class AppGen {
    public static void main(String[] args) {
        String s = gen(String.class);
        Integer n =gen(Integer.class);
        System.out.println(s);
        System.out.println(n);
    }
    public static <T> T  gen(Class<?> c){
        T t =null;
        if (c.isAssignableFrom(String.class)){
            String s = RandomStringUtils.randomAlphabetic(5);
            t= (T)s;

        }
        else if(c.isAssignableFrom(Integer.class)){
            Integer i = RandomUtils.nextInt();
            t=(T)i;
        }
        return  t;
    }
}
